{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/backspace-string-compare\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of Rust online submissions for Backspace String Compare.\n",
    "Memory Usage: 2.2 MB, less than 50.00% of Rust online submissions for Backspace String Compare.\n",
    "\n",
    "\n",
    "```rust\n",
    "pub struct Solution {}\n",
    "\n",
    "impl Solution {\n",
    "    fn inputBox(s: String) -> String {\n",
    "        let mut r = \"\".to_string();\n",
    "        for (i, c) in s.chars().enumerate() {\n",
    "            if (c == '#') {\n",
    "                if (r.len() > 0) {\n",
    "                    r.pop();\n",
    "                }\n",
    "            } else {\n",
    "                r.push(c);\n",
    "            }\n",
    "        }\n",
    "        return r;\n",
    "    }\n",
    "\n",
    "    pub fn backspace_compare(s: String, t: String) -> bool {\n",
    "        return Solution::inputBox(s).eq(&Solution::inputBox(t));\n",
    "    }\n",
    "}\n",
    "\n",
    "fn main() {\n",
    "    let r: bool = Solution::backspace_compare(String::from(\"abc###\"), String::from(\"bca###\"));\n",
    "    println!(\"{}\", r as i32);\n",
    "}\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Rust",
   "language": "rust",
   "name": "rust"
  },
  "language_info": {
   "codemirror_mode": "rust",
   "file_extension": ".rs",
   "mimetype": "text/rust",
   "name": "Rust",
   "pygment_lexer": "rust",
   "version": ""
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
